import { ResPage, User } from "@/api/interface";
import { PORT1 } from "@/api/config/servicePort";

import http from "@/api";

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = (params: any) => {
	return http.get<ResPage<User.ResUserList>>(PORT1 + `/User/index`, params);
};

export const getUsers = (params: any) => {
	return http.get<ResPage<User.ResUserList>>(PORT1 + `/User/getUsers`, params);
}

// 新增用户
export const addUser = (data: any) => {
	return http.post(PORT1 + `/User/add`, data);
};

// 编辑用户
export const editUser = (data: any) => {
	return http.post(PORT1 + `/User/edit`, data);
};

// 删除用户
export const deleteUser = (params: { id: string }) => {
	return http.get(PORT1 + `/User/del`, params);
};

// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
	return http.get(PORT1 + `/User/changeStatus`, params);
};
